package com.baidu.iit.hib.entity;

import java.util.Set;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;

/**
 * 用户组实体.
 * 
 * @author GuoLin
 *
 */
@Entity
@Table(name="hib_user_group")
public class UserGroup {

	private Long id;
	
	private String name;
	
	private Set<User> users;

	@Id
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@OneToMany(fetch=FetchType.LAZY, mappedBy="userGroup")
	@Fetch(FetchMode.SUBSELECT)
	public Set<User> getUsers() {
		return users;
	}

	public void setUsers(Set<User> users) {
		this.users = users;
	}
	
}
